package com.lionxing.DNTG;

import org.cocos2d.actions.CCProgressTimer;
import org.cocos2d.layers.CCLayer;
import org.cocos2d.layers.CCScene;
import org.cocos2d.nodes.CCDirector;
import org.cocos2d.nodes.CCSprite;
import org.cocos2d.types.CGPoint;
import org.cocos2d.types.CGSize;

import android.view.MotionEvent;

//import com.cronlygames.cocos2d.template.R.string;

public class showPicLayer extends CCLayer{
	
	int _value,_step;
	
	public static CCScene scene(int pic, int step) {
		CCScene scene = CCScene.node();
		showPicLayer layer = new showPicLayer(pic,step);

		scene.addChild(layer);
		
		return scene;
	}
	
	
	protected showPicLayer()
	{
		
		
	}
	
	
	protected showPicLayer(int pic, int step)
	{
		_value = pic;
		_step = step;
		this.setIsTouchEnabled(true);
		
		if(pic > 72)
		{
			pic = 72;
		}
		
		String tmp = String.format("%d.png", pic);
		
		CGSize size = CCDirector.sharedDirector().winSize();
		
		CCSprite bgSp = CCSprite.sprite(tmp);
		
		
		bgSp.setScaleX((size.width/GameDefine.KIos_W));
		bgSp.setScaleY((size.height/GameDefine.KIos_h));
		bgSp.setPosition(CGPoint.make(size.width/2, size.height/2));
		//Log.
		addChild(bgSp, -1);
		
		
		
	}
	
	
	 public boolean ccTouchesBegan(MotionEvent event)
	 {
		 
	    return true;
	 }

	 public boolean ccTouchesMoved(MotionEvent event)
	 {
	 	
	   return true;
	 }

	 public boolean ccTouchesEnded(MotionEvent event)
	 {
		playSound.sharedDirector().playEffectSound(R.raw.kick);	
 		CCScene scene = completeLayer.scene(_value,_step);
  		 //CCDirector.sharedDirector().replaceScene(scene);
 		 scenemanager.go(scene);
	   	return true;
	 }

	 public boolean ccTouchesCancelled(MotionEvent event)
	 {
	    	
	    return true;
	 }
	

	 public  void onExit()
		{		
				this.removeAllChildren(true);
				super.onExit();
		}
}
